package com.hmsg.health.bean.enums;

public enum StatusCode implements CodeEnum {

    /**
     * 00XX  系统级别
     * 2XXX  用户级别，比如2004 用户不存在
     * 4XXX  资源不存在，比如4004 xx不存在
     * 5XXX  系统错误相关，比如 5005 系统超时
     * 6XXX  评价
     */

    SYSTEM_WAIT(0, "处理中"),
    SYSTEM_SUCCESS(1,"成功"),
    SYSTEM_ORDER_SUCCESS(1,"支付成功"),
    SYSTEM_ERROR(-1,"未知错误"),
    TOKEN_ERROR(9014, "登录状态失效,请重新登录"),
    USER_EXIST(1001,"用户已存在"),
    USER_NOTPASS(1001,"用户未审核通过"),
    USER_NOT_EXIST(1002,"用户不存在"),
    USER_ACCOUNT_NOT_ENOUGH(1003,"用户金币不足"),
    USER_AUTHORIZE_ERROR(1006,"获取用户信息失败"),
    USER_SMS_NOTPHONE(1003,"用户未绑定手机号或用户不存在"),
    USER_EXIPHONE(1008,"绑定手机号已存在"),
    LOGIN_ERR(1004,"登录状态失效"),
    SIGNIN_ERR(1007,"今日已签到"),

    PASSWORD_ERROR(1005,"密码错误"),
    CODE_ERROR(1006,"邀请码错误"),
    SCORE_NOT_FULL(2001,"积分不足"),
    PASSWORD_NOT_EXISE(2002,"密码为空"),
    XCODE_ERROR(2003,"验证码错误"),
    SEND_XCODE_TIME_ERROR(2004, "验证码过于频繁"),
    USER_INVITE_ERROR(2005,"您已经被邀请，不能重复填写"),
    INVITE_ERROR(2011,"邀请码错误~"),
    TASK_COUNT_NOT_ENOUGH(2009,"手慢了！任务已被抢光~"),
    CANNOT_GET_TASK(2010,"您不能领取自己发布的任务~"),
    WITHDRAW_ERROR(2012,"非首次提现必须大于1元~"),
    TASK_STATUS_ERROR(2013,"任务失效"),
    AOUNT_ERROR(2014,"支付宝账号格式有误~"),
    SANDBOX_ERROR(2006,"收据信息是测试用（sandbox），但却被发送到正式环境中验证"),
    RECEIPT_ERROR(2007,"receipt是生产receipt，但却发送至Sandbox环境的验证服务"),
    TASK_NULL(2009,"已经没有其他任务了~"),
    
    VERIFY_ERROR(2008,"验证支付信息失败-2"),
    SELF_INVITE_ERROR(2010,"不能填写自己的邀请码~"),
    JUST_ONE_TIME(2011,"邀请码填写每人仅限一次~"),
    ALREADY_SHARE(2012,"已经分享过了~"),
    ALREADY_SIGN(2013,"今天已经签到了，明天再来吧~"),
    ;
	

    private int code;
    private String message;

    StatusCode(int code, String message) {
        this.code = code;
        this.message = message;
    }

    @Override
    public int getCode() {
        return this.code;
    }

    @Override
    public String getMessage() {
        return this.message;
    }

    public static StatusCode getErrorCode(int code) {
        StatusCode[] values = StatusCode.values();
        for (StatusCode error : values) {
            if (error.getCode() == code) {
                return error;
            }
        }
        return null;
    }

}
